const app = document.getElementById('app')
for(let i = 0; i < 10; i++){
  const a = document.createElement('a');
  a.href="javascript:;";
  a.addEventListener('click', function () {
    alert(i)
  })
  a.innerHTML = `标签${i}`;
  app.append(a)
}